package com.sright.bcard.content.biz.service;

import com.sright.bcard.common.service.share.dto.content.DataResultDTO;
import com.sright.bcard.content.biz.manager.DataManager;
import com.sright.bcard.content.share.request.CountButtonParam;
import com.sright.bcard.content.share.service.DataService;
import com.sright.common.response.SrightResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

@Component
@Slf4j
public class DataServiceImpl implements DataService {
    @Autowired
    DataManager dataManager;

    @Override
    public SrightResponse<Boolean> recordShareNum(Long cardId, Long userId) {
        return SrightResponse.defaultSuccess(dataManager.recordShareNum(cardId,userId));
    }

    @Override
    public SrightResponse<Long> countClickOne(Long cardId, Long userId) {
        return SrightResponse.defaultSuccess(dataManager.countClickOne(cardId,userId));
    }

    @Override
    public SrightResponse<Long> countClick(Long cardId, Integer type, Long memberId) {
        return SrightResponse.defaultSuccess(dataManager.countClick(cardId,type,memberId));
    }

    @Override
    public SrightResponse<Boolean> updateLoginTime(Long userId) {
        return SrightResponse.defaultSuccess(dataManager.updateLoginTime(userId));
    }

    @Override
    public SrightResponse<Long> countButton(CountButtonParam param,HttpServletRequest request) {
        return SrightResponse.defaultSuccess(dataManager.countButton(param,request));
    }

    @Override
    public SrightResponse<DataResultDTO> dataResult(Long userId) {
        return SrightResponse.defaultSuccess(dataManager.dataResult(userId));
    }
}
